package me.softwareengineer.guice.rendering.domain;

import java.util.Map;

/**
 * A property is generic value which can be stored in the elements. Each element
 * can have one or more property. property is used to store addition information
 * in the elements. For instance, XHTML render uses property to store the tag
 * attributes.
 * 
 * 
 * @author yadtahir
 * 
 */
public interface HasProperties {
	/**
	 * 
	 * @return all the property records of the current element.
	 */
	Map<String, String> getAllProperties();

	/**
	 * 
	 * @param propertyName
	 *            the name of the property.
	 * @return the value of property or null if the property does not exist
	 */
	String getProperty(String propertyName);

	/**
	 * 
	 * @param name
	 *            property name
	 * @return true if the property value exists in the current element.
	 *         Otherwise, false.
	 *         <p>
	 *         This method is a thread-safe method and can be accessed
	 *         concurrently
	 *         </p>
	 */
	boolean propertyExist(String name);

	/**
	 * Removes the property from the element
	 * 
	 * @param name
	 *            the name of the property
	 *            <p>
	 *            This method is a thread-safe method and can be accessed
	 *            concurrently
	 *            </p>
	 */
	void removeProperty(String name);

	/**
	 * Sets the provided property records to the current element
	 * 
	 * @param propertyRecords
	 *            <p>
	 *            This method is a thread-safe method and can be accessed
	 *            concurrently
	 *            </p>
	 */
	void setProperties(Map<String, String> propertyRecords);

	/**
	 * Sets the given property to the current element. To set multiple property
	 * record, see {@link #setProperties(Map)}
	 * 
	 * @param name
	 *            the name of property
	 * @param value
	 *            the value of property
	 * @see {@link Element#getProperty(String)}
	 *      <p>
	 *      This method is a thread-safe method and can be accessed concurrently
	 *      </p>
	 */
	void setProperty(String name, String value);
}
